<template>
	<view class="flexrow   container"   @click='deviceNoDealListItemClick'>
    <image class="device-image margin" :src="getImageUrl(data.productImg)"></image>
  <view class="content">
			<view class="firstLine ">
        <view class="flexrow">
				<text class="firstLinetitle">{{data.deviceName}}</text>
        <view class="firstLinetime bgwhite-blue-btn padding-lr-xs flexcenter"
              v-if="data.lineStatus == 1">
          <text class="text-xs text-center">在线</text>
        </view>
        <view class="firstLinetime bggray-black-btn padding-lr-xs flexcenter"
              v-if="data.lineStatus == 0">
          <text class="text-xs text-center"> 离线</text>
        </view>
        </view>
        <view style="flex:1"/>
        <view class="imageLineStatus">
          <image class="imageLineStatus" v-if="data.lineStatus == 0" src="@/static/images/off_line.png"></image>
          <image class="imageLineStatus"  v-if="data.lineStatus == 1" src="@/static/images/on_line.gif"></image>
        </view>
			</view>
			<view class="normalLine">
        <image src="@/static/images/common/police-building.png" class="normalLine-icon"></image>
				<text class="text-sm text-gray">{{ data.buildingName }}</text>
					</view>
			<view class="normalLine">
				<image src="@/static/images/common/police-build-address.png" class="normalLine-icon"></image>
				<text class="text-xs text-gray">{{ data.address }}</text>
			</view>
    <view class="normalLine flexrowflexend margin-right">
    <text class="text-xs text-gray margin-left-sm">最新数据上传时间: {{  dateFomatterYYYYMMDD (data.createTime)}}</text>
    </view>
  </view>
  </view>
</template>
<script >
  import config from '@/config'
  const imageUrl = config.imageUrl
	import dayjs from "dayjs";
  export default {
		name: "device-nodeal-list-item",
		props:{
      data:Object,
      default () {
        return {}
      }
		},
		data() {
			return {};
		},
		computed: {},
		methods: {
      getImageUrl(url){
        return imageUrl+url
      },
      dateFomatterYYYYMMDD (date) {
        return date ? dayjs(date).format('YYYY-MM-DD HH:mm:ss') : ''
      },
			deviceNoDealListItemClick() {
				this.$emit('deviceNoDealListItemClick',this.data)
			}
		}
	}
</script>

<style scoped>
  .content {
    flex:1;
    display: flex;
    flex-direction: column;
  }
	.container {
    background-color: rgba(255, 255, 255, 0.7);
    /*box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);*/
		margin-top: 20rpx;
    padding-top: 10rpx;
    padding-bottom: 20rpx;
		width: 720rpx;
		border-radius: 10rpx;
		margin-left: 15rpx;
		margin-right: 15rpx;
		display: flex;
	}

	.firstLine {
		margin-left: 20rpx;
    margin-right: 10rpx;
		display: flex;
    height:30px;
		flex-direction: row;
		align-items: center;
	}
	.firstLinetitle {
		font-size: 12px;
		font-weight:400;
		color: #333333;
	}

	.firstLinetime {
		margin-left: 10rpx;
		font-size: 14px;
	}

	.normalLine {
		display: flex;
		flex-direction: row;
		align-items: center;
		padding-left: 10rpx;
		/*padding-bottom: 20rpx;*/
		padding-top: 10rpx;

	}
  .device-image{
    width:120rpx;
    height:120rpx
  }

	.normalLine-icon {
		margin-right: 5px;
		width: 18px;
		height:18px;
	}

  .imageLineStatus{
    width:20px;
    height:20px
  }
</style>